package com.matt.controller.web;

import com.matt.commons.model.StatusResponse;
import com.matt.domain.TeachOperationLog;
import com.matt.foundation.model.MemVerificationCache;
import com.matt.foundation.query.OperationLogQuery;
import com.matt.service.TeachOperationLogService;
import com.matt.service.remoteCall.SsoCallService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/7/21
 * *******************************
 */
@RestController
@RequestMapping("/web/other")
public class WebOtherController {

    @Autowired
    private SsoCallService ssoCallService;

    @Autowired
    private MemVerificationCache cache;

    @Autowired
    private TeachOperationLogService teachOperationLogService;

    @ApiOperation(value = "操作日志记录",httpMethod = "POST")
    @RequestMapping("operation_log_page")
    public StatusResponse operationLog(@RequestHeader String ticket, OperationLogQuery query) {
        query.setAreaId(cache.getAreaId(ticket));
        Page<TeachOperationLog> logPage = teachOperationLogService.getLogByCondition(query);
        return StatusResponse.success(logPage);
    }
}
